fix: recover android network dump after stale logcat pid#363
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a14617e510
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!trackedPid) { | ||
| return null; | ||
| } | ||
| const currentPid = await resolveAndroidPid(device.id, appBundleId); |
There was a problem hiding this comment.
Add timeout to stale-PID probe before network dump
In readSessionNetworkCapture, active Android sessions now run resolveAndroidPid unconditionally to detect stale logcat PID bindings, but that helper runs adb shell pidof without a timeout. If adb transport is wedged (for example, flaky USB/emulator bridge), network dump can hang even though parsing the existing session app.log would have succeeded. This is a regression specific to the new stale-active path; make the PID probe best-effort with a short timeout and skip recovery when it fails.
Useful? React with 👍 / 👎.
Summary
Recover Android
network dumpwhen the session logcat stream staysactivebut is still bound to a previous app PID after a process restart.Detect the tracked
--pidfrom the session app-log metadata, compare it with the app's current PID, and reuse the existing boundedadb logcat -drecovery path when they diverge. Add focused coverage for the stale-active PID case.Closes #333
Validation
pnpm formatpnpm check:quickpnpm check:unitnode --experimental-strip-types src/bin.ts open com.expensify.chat.dev --platform android --serial emulator-5552 --session issue333-followup --state-dir /tmp/agent-device-issue333-followupnode --experimental-strip-types src/bin.ts logs clear --restart --session issue333-followup --state-dir /tmp/agent-device-issue333-followupcom.expensify.chat.devprocess restart on the Android emulator and verifiednetwork dump 10returned fresh recovered HTTP entries with the stale-PID recovery note